home *** CD-ROM | disk | FTP | other *** search
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <html xmlns="http://www.w3.org/1999/xhtml"
- eventCookie="@@@eventCookie@@@" dtvPlatform="@@@dtvPlatform@@@">
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <link href="resource:css/main.css" rel="stylesheet" type="text/css" />
- <t:include filename="dynamic.js" />
- <script type="text/javascript" src="resource:templates/osxdnd.js" />
- <t:execOnLoad><![CDATA[
-
- folder = views.channelFolders.getObjectByID(int(kargs['id']))
- filters.switchNewItemsChannel(folder)
- sorts.switchUnwatchedFirstChannel(folder)
-
- def showDownloadsFilter(x):
- return showDownloads
-
- def showWatchableFilter(x):
- return showWatchableItems
-
- def showNewFilter(x):
- isNew = filters.newItems(x)
- # need to make call newItems() so that the filter remembers if the item
- # was flagged as new or not.
- return showNewItems and (allItemsMode or isNew)
-
- def updateSearchString(newSearch):
- global searchTerm
- if len(newSearch) == 0:
- searchTerm = None
- else:
- searchTerm = newSearch
- allItems.recomputeFilters()
-
- def toggleDownloadsView(handle):
- global showDownloads
- showDownloads = not showDownloads
- allDownloadingItems.recomputeFilter(downloadingItems)
- handle.forceUpdate()
-
- def toggleWatchableView(handle):
- global showWatchableItems
- showWatchableItems = not showWatchableItems
- allWatchableItems.recomputeFilter(watchableItems)
- handle.forceUpdate()
-
- def toggleNewItemsView(handle):
- global showNewItems
- showNewItems = not showNewItems
- matchingItems.recomputeFilter(newItems)
- handle.forceUpdate()
-
- def toggleAllItemsMode(handle):
- print "Toggling all items"
- global allItemsMode
- allItemsMode = not allItemsMode
- matchingItems.recomputeFilter(newItems)
- handle.forceUpdate()
-
- def setSortBy(by, which, handle):
- if which == 'main':
- folder.itemSort.setSortBy(by)
- matchingItems.recomputeSort(newItems)
- elif which == 'downloading':
- feed.itemSortDownloading.setSortBy(by)
- allDownloadingItems.recomputeSort(downloadingItems)
- else:
- folder.itemSortWatchable.setSortBy(by)
- allWatchableItems.recomputeSort(watchableItems)
- handle.forceUpdate()
-
- allFeeds = views.feeds.filterWithIndex(indexes.byFolder, folder)
-
- global searchTerm, showDownloads, showWatchableItems, showNewItems, allItemsMode
- searchTerm = None
-
- # The main section
- allItemsMode = False
-
- # Initial states of views in this template
- showDownloads = False
- showNewItems = True
- showWatchableItems = True
-
- allItems = views.items.filterWithIndex(indexes.itemsByChannelFolder, folder)
- notDeleted = allItems.filter(filters.notDeleted)
- matchingItems = notDeleted.filter(lambda x: filters.matchingItems(x, searchTerm))
- newItems = matchingItems.filter(showNewFilter, sortFunc=folder.itemSort.sort, resort=True)
-
- allDownloadingItems = matchingItems.filter(filters.downloadingOrPausedItems)
- downloadingItems = allDownloadingItems.filter(showDownloadsFilter,sortFunc=folder.itemSortDownloading.sort,resort=True)
- allWatchableItems = matchingItems.filter(filters.watchableItems)
- watchableItems = allWatchableItems.filter(showWatchableFilter,sortFunc=folder.itemSortWatchable.sort, resort=True)
-
- thisFolderView = views.channelFolders.filter(lambda x: x is folder)
- childrenView = views.feeds.filterWithIndex(indexes.byFolder, folder)
-
- # Make the channel-content template happy
- thisFeedView = thisFolderView
- feed = None
- itemSort = folder.itemSort
- itemSortDownloading = folder.itemSortDownloading
- itemSortWatchable = folder.itemSortWatchable
-
- def allItemsHaveState(view, state):
- for item in view:
- if item.getState() != state:
- return False
- return True
- def allItemsPaused(view):
- return allItemsHaveState(view, 'paused')
- def allItemsDownloading(view):
- return allItemsHaveState(view, 'downloading')
-
- showNewItems = (len(watchableItems) == 0) or len(newItems) > 0
-
- if len(newItems) == 0:
- allItemsMode = True
- matchingItems.recomputeFilter(newItems)
-
- for feed in allFeeds:
- feed.updateIcons()
-
- isFolder = True
- ]]>
- </t:execOnLoad>
- <t:execOnUnload><![CDATA[
- matchingItems.unlink()
- thisFolderView.unlink()
- notDeleted.unlink()
- allItems.unlink()
- for feed in allFeeds:
- if feed.idExists():
- feed.markAsViewed()
- ]]>
- </t:execOnUnload>
- </head>
-
- <body dragdesttype="channel"
- dragdestdata="channelfolder-***folder.getID()***"
- drageffectchannel="move"
- onkeydown="sendKeyToSearchBox(event);">
- <div id="main-titlebar">
- <img id="main-icon" src="resource:images/folder-icon.png" alt="" />
- <div t:updateForView="thisFolderView">
- <h1 id="main-title" t:replace="folder.getTitle()" />
- </div>
- </div>
- <div id="main-container">
- <t:includeTemplate filename="channel-content" />
- </div>
- <div t:updateForView="childrenView">
- <div t:showIf="childrenView.len() == 0">
- <div class="channel-blank">
- <div class="channel-message" i18n:translate="">
- Empty Channel Folder
- </div>
- <div class="channel-message small" i18n:translate="">
- Drag channels to this folder to add them.
- </div>
- </div>
- </div>
- </div>
- </body>
- </html>
-